﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Prism.Logging;
using log4net;
using log4net.Config;

namespace Tanmia.Basis.Concretes
{
    /// <summary>
    /// Setup a Log4net logger to replace the default trace logger.
    /// </summary>
    public class Log4NetLogger : ILoggerFacade
    {
        private static ILog logger = LogManager.GetLogger("Tanmia Application");

        public Log4NetLogger()
        {
            XmlConfigurator.Configure();
        }

        #region ILoggerFacade Members

        public void Log(string message, Category category, Priority priority)
        {
            switch (category)
            {
                case Category.Debug:
                    logger.Debug(message);
                    return;

                case Category.Exception:
                    logger.Error(message);
                    return;

                case Category.Info:
                    logger.Info(message);
                    return;

                case Category.Warn:
                    logger.Warn(message);
                    return;
            }
        }

        #endregion
    }
}
